<!DOCTYPE html>
<html  lang="zh-CN"
       xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>消息</title>
    <meta charset="UTF-8">
    <title>消息</title>
    <meta name="keywords" content="消息"/>
    <meta name="description" content="消息"/>
    <meta name="viewport" content="width=device-width,initial-scale=1, maximum-scale=1,minimum-scale=1, user-scalable=no">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="format-detection" content="telephone=no"/>
    <meta name="viewport" content="width=device-width,viewport-fit=cover">
    <meta name="_csrf" th:content="${_csrf.token}"/>
    <meta name="_csrf_header"  th:content="${_csrf.headerName}"/>
    <link rel="stylesheet" type="text/css" th:href="@{/shoppingApi/css/public.css}">
    <link rel="stylesheet" type="text/css" th:href="@{/shoppingApi/css/publicOfuser.css}">
    <link rel="stylesheet" type="text/css" th:href="@{/shoppingApi/css/jquery-weui.min.css}">
    <link rel="stylesheet" type="text/css" th:href="@{/shoppingApi/css/weui.min.css}">
    <link rel="stylesheet" type="text/css" th:href="@{/shoppingApi/css/notice-bulletin.css}">
    <script type="text/javascript" th:src="@{/shoppingApi/js/jquery-3.3.1.min.js}"></script>
    <script type="application/javascript" th:src="@{/shoppingApi/js/common.js}"></script>
</head>

<body>

<div class="main msg">

    <div class="main_con c323232">

        <div class="weui-cells" style="margin: 0px;">

            <div class="weui-cell" style="padding: 0px" id="activity">

                <div class="weui-cell__bd">

                    <a>
                        <div class="bgfff msg-item">

                            <img  th:src="@{/shoppingApi/images/icon_activity_message.png}" class="fl active" style="height: 48px;height: 50px">

                            <div>

                                <div class="ft15">
                                    <span class="ml15" active-sign>活动消息</span>
                                    <span class="fr mt5 c969696 active-time"></span>
                                </div>

                                <p class="msg-content ft12 c969696 pl15 mt5   active-msg-content"></p>

                            </div>

                        </div>
                    </a>
                    <!--消息条数-->
                    <span class="weui-badge active-msg-count" style="position: absolute;top:10px;left: 55px; min-width: 10px;min-height: 10px">0</span>
                </div>
            </div>

            <div class="weui-cell" style="padding: 0px" id="sysnotice">

                <div class="weui-cell__bd">

                    <a>
                        <div class="bgfff msg-item">

                            <img  th:src="@{/shoppingApi/images/icon_notice.png}" class="fl sys-msg" style="height: 48px;height: 50px">

                            <div>

                                <div class="ft15">
                                    <span class="ml15">公告/通知</span>
                                    <span class="fr mt5 c969696  sys-msg-time"></span>
                                </div>

                                <p class="msg-content ft12 c969696 pl15 mt5 sys-msg-content"></p>

                            </div>

                        </div>
                    </a>

                    <span class="weui-badge sys-msg-count"
                          style="position: absolute;top:10px;left: 55px; min-width: 10px;min-height: 10px">0</span>
                </div>
            </div>

        </div>

    </div>
</div>
</body>
<script type="application/javascript">
    $(function () {
       getSysMessage();
       getActiveMessage();
        selectSysMessageCount();
        selectActiveMessageCount();
    })


  //获取活动消息
    function  getActiveMessage() {
        $.ajax({
            url:'/wap/getActiveMessageData?sSign='+"0",
            success:function (result) {
                console.log(result);
                var time=result.message.sTime;
                var str=time.substr(0,10);
                $('.active-time').html(str);
                $('.active-msg-content').html(result.message.sContent);

            }
        })
    }

    //获取系统消息
    function  getSysMessage() {
        $.ajax({
            url:'/wap/getSysMessageData?sSign='+"1",
            success:function (result) {
                console.log(result);
                var time=result.message.sTime;
                var str=time.substr(0,10);
                $('.sys-msg-time').html(str);
                $('.sys-msg-content').html(result.message.sContent);

            }
        })
    }
    
    //打开活动消息列表
    $('#activity').on('click',function () {
        window.location.href="/wap/openActiveMessage";
    })

    //打开公告消息列表
    $('#sysnotice').on('click',function () {
        window.location.href="/wap/openSysMessage";
    })

    /*查询系统消息的条数*/
  function selectSysMessageCount() {
      $.ajax({
          url:'/wap/selectSysMessageCount?sSign=0',
          success:function (res) {
              $('.sys-msg-count').html(res);
              if(res==0){
                  $('.sys-msg-count').hide();
              }
          }
      })
  }


    /*查询活动消息的条数*/
    function selectActiveMessageCount() {
        $.ajax({
            url:'/wap/selectSysMessageCount?sSign=1',
            success:function (res) {
                $('.sys-msg-count').html(res);
                $('.active-msg-count').html(res);
                if(res==0){
                    $('.active-msg-count').hide();
                }
            }
        })
    }

</script>

</html>